package site.shenjie.demo.controller;

import cn.hutool.json.JSONUtil;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.shenjie.demo.model.User;

/**
 * @author ShenJie
 * 2022/2/15 16:17
 */
@Validated
@RestController
@RequestMapping("/hello")
public class HelloWorldController {
    /**
     * 第一个接口
     *
     * @return 接口返回内容，一般会以JSON字符串的形式返回给前端
     */
    @GetMapping("/world")
    public String world(@Validated User user) {
        return JSONUtil.toJsonStr(user);
    }
}
